#include <stdlib.h>
#include "Vector.h"
#include "VectorIter.h"

VectorIter* vector_iter_new(Vector* vector)
{
  VectorIter* iter = (VectorIter*)calloc(sizeof(VectorIter), 0);
  iter->vector     = vector;
  iter->pos        = 0;
  return iter;
}

void vector_iter_free(VectorIter* iter)
{
  free(iter);
}

VectorIter* vector_iter_prev(VectorIter* iter)
{
  iter->pos--;
  return iter;
}

VectorIter* vector_iter_next(VectorIter* iter)
{
  iter->pos++;
  return iter;
}

void* vector_iter_get_data(VectorIter* iter)
{
  return vector_get(iter->vector, iter->pos);
}
